<?php
namespace App\Controllers;

use Framework\Database;

class HomeController {
    protected $db;
    public function __construct() {
        // Constructor's content
        $config=require basePath('config/db.php');
        $this->db=new Database($config);
    }

    public function index() {
        $listings=$this->db->query('SELECT * FROM listing ORDER BY created_at DESC LIMIT 6')->fetchAll();
        loadView('home',[
            'listings'=>$listings
        ]);

    }
}